﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Easyui扩展库 Window - 落阳 整理</title>
    <link href="http://www.easyui-extlib.com/Content/Site.css" rel="stylesheet" />
    <script src="http://www.easyui-extlib.com/Scripts/jquery/jquery-1.11.0.min.js"></script>
    <script src="http://www.easyui-extlib.com/Scripts/jquery-extensions/jquery.jdirk.js"></script>
    <link href="http://www.easyui-extlib.com/Scripts/jquery-easyui/jquery-easyui-1.4.3/themes/default/easyui.css" rel="stylesheet" />
    <link href="http://www.easyui-extlib.com/Scripts/jquery-easyui/jquery-easyui-1.4.3/themes/icon.css" rel="stylesheet" />
    <script src="http://www.easyui-extlib.com/Scripts/jquery-easyui/jquery-easyui-1.4.3/jquery.easyui.min.js"></script>
    <script src="http://www.easyui-extlib.com/Scripts/jquery-easyui/jquery-easyui-1.4.3/locale/easyui-lang-zh_CN.js"></script>

</head>
<body>
    <script>
        $(function () {

            var checkExtJs = function () {
                var topHead = $("head"),
                    existHeadContent = topHead.html(),
                    exist = $.string.contains(existHeadContent, "jeasyui.extensions.window.autoCenter.js");

                return exist;
            };

            $("#btnAppendExtJs").click(function () {
                if (checkExtJs()) {
                    alert("已经添加 autoCenter 扩展的引用，无需重复添加。");
                } else {
                    var jsUrl = ["http://www.easyui-extlib.com/Scripts/jquery-easyui-extensions/window/jeasyui.extensions.window.autoCenter.js"];
                    $.util.loadJs(jsUrl);
                    alert("autoCenter 扩展的引用添加成功。");
                    $("#msg").html("autoCenter 扩展的引用添加成功。再去调整浏览器尺寸试试。");
                }
            });
        });
    </script>
    <div class="easyui-panel" data-options="fit:true">
        <div id="w1" class="easyui-window" data-options="title:'hcenter、vcenter 为 true 的窗口',closed:false,hcenter:true,vcenter:true" style="height: 250px; width: 280px; padding: 5px;">
            我是一个“自动调节成水平居中并垂直居中”的 easyui-window。
            <br /><br />
            <span style="color:red;">本页面初始化时并未载入 autoCenter 的扩展脚本，所以此时当浏览器尺寸被调整时，easyui-window 并不会自动修正位置。</span>

            <br /><br />
            <a id="btnAppendExtJs" class="easyui-linkbutton" data-options="iconCls:'icon-add'">向本页面中载入扩展js</a>
            <br />
            <span style="color:red;" id="msg"></span>
            <br /><br />
        </div>
    </div>
</body>
</html>
